import javax.sound.sampled.Clip;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import java.util.Scanner;

/**
 * @description:
 * @author: 马跃
 * @create: 2021-01-25 17:33
 **/
public class cs {
    public static void main(String[] args) throws AWTException {
        Robot robot = new Robot();
        robot.delay(2000);

        Scanner scanner = new Scanner(System.in);
        System.out.println("Please input  your sentence");
        String next = scanner.next();
        System.out.println("Please input the number that you want loop");
        int i = scanner.nextInt();
        Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        for (int i1 = 0; i1 < i; i1++) {
            StringSelection stringSelection = new StringSelection(next);
            systemClipboard.setContents(stringSelection,null);
            robot.keyPress(KeyEvent.VK_CONTROL);
            robot.keyPress(KeyEvent.VK_V);
            robot.keyRelease(KeyEvent.VK_CONTROL);
            robot.delay(500);
            robot.keyPress(KeyEvent.VK_ENTER);
        }
    }
}
